/*
 * This file is part of Space Invaders: Rehash
 * Copyright (C)2007 Vicent Marti (tanoku@gmail.com)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef	_GAME_MISSILE_H_
#define	_GAME_MISSILE_H_

#include "SDL.h"
#include <stdio.h>
#include <string>
#include <vector>

#include "game.h"
#include "timer.h"
#include "main.h"
#include "sprites.h"
#include "game_const.h"

class Game;
class Player;
class Alien;

class Missile
{
	int m_x;
	int m_y;
	int m_speed;
	float m_angle;
	
	int m_number;
	int m_type;
	char m_numberStr[8];
	
	float m_rotation;
	
	bool m_disabled;
	
	Game *m_parent;
	
	SimpleTimer m_smokeTimer;
	int m_smokeCount;
	int m_trailSound;
	
public:
	Missile( Game *parent, int x, int y, int speed, float angle, int number = 0 );
	
	void render();
	void tick();
	bool colCheck();
	
	int getNumber() { return m_number; }
	
	void getExplosionCoords( int &x, int &y )
	{
		x = m_x;
		y = m_y;
	}
	
	~Missile()
	{
	    if ( m_trailSound != -1 )
	        Mix_HaltChannel(m_trailSound);
	}
};


#endif
